#include "TurnsMenu.h"
#include "Utilities.h"
#include "PrintUtilities.h"
#include "ServiceProvider.h"
#include "League.h"
#include "LeagueManager.h"
#include "MenuManager.h"
#include "GamePrintUtils.h"
#include "Types.h"
#include "StringUtilities.h"

TurnsMenu::TurnsMenu(MenuManager* const i_menuManager)
	: Menu(i_menuManager)
	, m_leagueID(Utilities::INVALID_ID)
{
}

void TurnsMenu::Draw() const
{
	const LeagueVec& leagues = GetSP()->GetLeagueMgr().GetLeagues(true);

	STD::cout << Print::Title("THIS SEASON TURNS:");
	STD::cout << "LEAGUE " << leagues.at(m_leagueID)->GetName() << STD::endl;
	PrintCalendar(STD::cout, *leagues.at(m_leagueID), GetSP());
	STD::cout << STD::endl;

	STL::string options = "0) Return to previous menu'.";
	STD::cout << Print::Options(options) << "Selection: ";
}


bool TurnsMenu::Input(const STL::string& i_input)
{
	bool goodInput = true;

	size_t res = Utilities::StringToInt(i_input);

	if (res == 0)
		GetMM()->SetMenu(GetMM()->GetLeagueStatsMenu());
	else
		goodInput = false;

	return goodInput;
}